package com.michale.common.annotation;

import com.michale.common.constants.RedisCacheConstant;
import com.michale.common.enmus.LimitType;
import io.swagger.annotations.ApiModelProperty;

import java.lang.annotation.*;


/**
 * @author Michale
 * @apiNote 限流注解
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface RateLimiter {

    @ApiModelProperty("限流key")
    String key() default RedisCacheConstant.RATE_LIMIT_KEY;

    @ApiModelProperty("限流时间,单位秒")
    int time() default 60;

    @ApiModelProperty("限流次数")
    int count() default 100;

    @ApiModelProperty("限流类型")
    LimitType limitType() default LimitType.DEFAULT;
}
